package org.example.elm_springboot.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.elm_springboot.mapper.CartMapper;
import org.example.elm_springboot.po.Cart;
import org.example.elm_springboot.service.CartService;

@Service
public class CartServiceImpl implements CartService {
    
    @Autowired
    private CartMapper cartMapper;
    
    @Override
    public List<Cart> listCart(String userId, Integer businessId) {
        Cart cart = new Cart();
        cart.setUserId(userId);
        cart.setBusinessId(businessId);
        return cartMapper.listCart(cart);
    }
    
    @Override
    public int saveCart(Cart cart) {
        return cartMapper.saveCart(cart);
    }
    
    @Override
    public int updateCart(Cart cart) {
        return cartMapper.updateCart(cart);
    }
    
    @Override
    public int removeCart(String userId, Integer businessId) {
        Cart cart = new Cart();
        cart.setUserId(userId);
        cart.setBusinessId(businessId);
        return cartMapper.removeCart(cart);
    }
} 